package com.xiaolong.redis.factory;

import com.xiaolong.common.utils.SpringUtil;
import com.xiaolong.redis.enums.CachePoliciesEnum;
import com.xiaolong.redis.handle.*;

public class CacheHandlerFactory {

    public static CacheHandler routingCacheHandler(CachePoliciesEnum cacheTypeEnum){
        if (cacheTypeEnum.getTypeCode()==CachePoliciesEnum.NOEXPIRATION.getTypeCode()){
            return SpringUtil.getBean(NoExpirationCacheHandler.class);
        }
        return SpringUtil.getBean(ExpireCacheHandler.class);
    }
}
